#!/bin/bash
#

log_dir=/tmp

current_timestamp=$(date +%s)

for log_file in "$log_dir"/*;do
	if [ -f $log_file ];then
		file_mod_timestamp=$(stat -c %Y "$log_file")
		file_age_days=$((current_timestamp-file_mod_timestamp/86400))
		if [ $file_age_days -gt 1 ];then
			echo "Deleting $log_file (Last modified:$(date -d @$file_mod_timestamp))"
			rm "$log_file"
		fi
	fi
done
